using System.Text.Json;
using System.Threading.Tasks;
using Order;
using Grpc.Core;
using Microsoft.Extensions.Logging;

namespace Server
{
    public class OrderService : Order.Order.OrderBase
    {
        private readonly ILogger _logger;

        public OrderService(ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger<OrderService>();
        }

        public override Task<CommonResult> CreateOrder(CreateOrderRequest request, ServerCallContext context)
        {
            _logger.LogInformation("收到请求:{json}",JsonSerializer.Serialize(request));
            return Task.FromResult(new CommonResult { Success = true, OrderId = 1 });
        }
    }
}